﻿using System;
using ScriptUtilities;

namespace ScriptUtilities
{
    public static class Helper
    {
        public static T Clamp<T>(this T value, T min, T max) where T : IComparable<T>
        {
            if (value.CompareTo(min) < 0) return min;
            else if (value.CompareTo(max) > 0) return max;
            else return value;
        }

        public static bool IsInRange(float value, float range) => (value <= +range && value >= -range);
    }
}
